home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-08-27 | 3.4 KB | 137 lines | [TEXT/MMCC] |
- //---------------------------------------------------------------------------------------
- //
- // List Tester: Main
- //
- //---------------------------------------------------------------------------------------
-
- #include <string.h>
- #include <LApplication.h>
- #include <LWindow.h>
- #include <LGrowZone.h>
- #include <UScreenPort.h>
- #include <PPobClasses.h>
- #include <URegistrar.h>
- #include <UMemoryMgr.h>
- #include <UPowerTools.h>
- #include <PP_Messages.h>
- #include "resources.h"
- #include "CMyCustomListBox.h"
- #include "CMyHierListBox.h"
- #include "CMyDiskListBox.h"
-
- //---------------------------------------------------------------------------------------
-
- class CListApp : public LApplication {
- public:
- CListApp(void);
- virtual ~CListApp(void);
-
- virtual Boolean ObeyCommand(CommandT inCommand, void* ioParam);
- virtual void FindCommandStatus(CommandT inCommand,
- Boolean &outEnabled, Boolean &outUsesMark,
- Char16 &outMark, Str255 outName);
-
- protected:
- virtual void StartUp();
-
- };
-
- //---------------------------------------------------------------------------------------
-
- CListApp::CListApp(void)
- {
- UScreenPort::Initialize();
-
- // 'RegisterAllPPClasses' registers all standard PowerPlant classes. Because many of them
- // are not needed by this application, it would add about 50K of unused code. Registering
- // the two classes we need, helps the linker removing redundant code.
- // RegisterAllPPClasses();
-
- URegistrar::RegisterClass('lbox', (ClassCreatorFunc) LListBox::CreateListBoxStream);
- URegistrar::RegisterClass('wind', (ClassCreatorFunc) LWindow::CreateWindowStream);
-
- URegistrar::RegisterClass (CMyCustomListBox::classID, (ClassCreatorFunc) CMyCustomListBox::CreateFromStream);
- URegistrar::RegisterClass (CMyHierListBox::classID, (ClassCreatorFunc) CMyHierListBox::CreateFromStream);
- URegistrar::RegisterClass (CMyDiskListBox::classID, (ClassCreatorFunc) CMyDiskListBox::CreateFromStream);
- }
-
- CListApp::~CListApp()
- {
- }
-
- void CListApp::StartUp()
- {
- ObeyCommand(cmd_New, nil);
- }
-
- //---------------------------------------------------------------------------------------
-
- Boolean CListApp::ObeyCommand(CommandT inCommand, void *ioParam)
- { Boolean cmdHandled = true;
-
- switch (inCommand) {
-
- case cmd_EasyList:
- LWindow::CreateWindow (EasyList_PPob, this);
- break ;
-
- case cmd_CustomList:
- LWindow::CreateWindow (CustomList_PPob, this);
- break;
-
- case cmd_HierList:
- LWindow::CreateWindow (HierList_PPob, this);
- break ;
-
- case cmd_DiskList:
- LWindow::CreateWindow (DiskList_PPob, this);
- break ;
-
- default:
- cmdHandled = LApplication::ObeyCommand (inCommand, ioParam);
- break;
- }
-
- return cmdHandled;
- }
-
- //---------------------------------------------------------------------------------------
-
- void CListApp::FindCommandStatus(
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- switch (inCommand) {
-
- case cmd_EasyList:
- case cmd_CustomList:
- case cmd_HierList:
- case cmd_DiskList:
- outEnabled = true;
- outUsesMark = false;
- break;
-
- default:
- LApplication::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-
- //---------------------------------------------------------------------------------------
-
- void main (void)
- {
- InitializeHeap(4);
- InitializeToolbox();
- new LGrowZone(20000);
-
- CListApp theApp;
- theApp.Run();
- }
-
- //---------------------------------------------------------------------------------------
-